<?php
/**
 * tool.php
 * @author konakona
 * @date 2009/6/13
 * @package helper
 * @version 1.0.0
 */
!class_exists('m')&&exit;

class tool {
    public static function createDirectory($dir) {
        if(is_array($dir)) {
            array_walk($dir,'tool::createDirectory');
            exit;
        }
        $arrTemp = explode(m::$DS,$dir);
        $path = '';
        foreach($arrTemp as $d) {
            if(empty($d)) {
                continue;
            }
            if(!empty($path))
                $path .= m::$DS.$d;
            else
                $path = $d;
            if(is_dir($path)||is_file($path)) { continue; } else {
                mkdir($path);
                if(!file_exists($path.m::$DS.'index.htm'))
                    m::write($path.m::$DS.'index.htm');
                }
        }
    }
}